#ifndef __OD_DEBUGPRINT_H__
#define __OD_DEBUGPRINT_H__
#include <stdio.h>
/* 开关状态枚举 */
typedef enum OnOff_State
{
  OFF,
  ON
} OnOffState_Enu;

/* 调试信息打印开关 结构体 */
typedef struct debug_state
{
  OnOffState_Enu Info;    /* 信息打印 */
  OnOffState_Enu Log;      /* 日志打印 */
  OnOffState_Enu Warning;    /* 报警打印 */
  OnOffState_Enu Error;    /* 错误打印 */
} DebugState_Str;

/* 调试打印等级 */
typedef enum debug_level
{
  DEBUG_LEVEL_INFO,
  DEBUG_LEVEL_LOG,
  DEBUG_LEVEL_WARNING,
  DEBUG_LEVEL_ERROR
} DebugLevel_Enu;

/* 定义调试信息最大长度 */
#define DEBUG_MAX_LEN         250

#define OD_DEBUG_EN           0

#define OD_DEBUG_INFO         1
#define OD_DEBUG_LOG          0
#define OD_DEBUG_WARNING      1
#define OD_DEBUG_ERROR        1

extern OnOffState_Enu DebugGetState(DebugLevel_Enu level);
extern void DebugSetState(DebugLevel_Enu level, OnOffState_Enu state);
extern void DebugPrint(DebugLevel_Enu level, char *format, ...);

#if OD_DEBUG_INFO
#define DEBUG_INFO(format, ...)     DebugPrint(DEBUG_LEVEL_INFO, format, ##__VA_ARGS__)
#else
#define DEBUG_INFO(format, ...)
#endif

#if OD_DEBUG_LOG
#define DEBUG_LOG(format, ...)      DebugPrint(DEBUG_LEVEL_LOG, format, ##__VA_ARGS__)
#else
#define DEBUG_LOG(format, ...)
#endif

#if OD_DEBUG_WARNING
#define DEBUG_WARNING(format, ...)  DebugPrint(DEBUG_LEVEL_WARNING, format, ##__VA_ARGS__)
#else
#define DEBUG_WARNING(format, ...)
#endif

#if OD_DEBUG_ERROR
#define DEBUG_ERROR(format, ...)    DebugPrint(DEBUG_LEVEL_ERROR, "Function->%s,Line->%d:"format,   __FUNCTION__, __LINE__,  ##__VA_ARGS__)
#else
#define DEBUG_ERROR(format, ...)
#endif

extern void OD_Assertion(void);
extern void OD_DebugPrintInit(void);
#endif
